/* 
 * Enterprise Library Extensions - DI + ORM.
 * Copyright (C) 2006
 *
 * GNU General Public License
 *
 * This program is free software; you can redistribute 
 * it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 */
using System;
using System.Collections;

namespace ELE.EnterpriseLibrary.Naming
{
	/// <summary>
	/// Type safe collection class that holds INames.
	/// </summary>
	public class NameCollection : CollectionBase
	{
    /// <summary>
    /// Indexer to access objects of the collection
    /// </summary>
    public IName this[int index]
    {
      get { return ((IName)(List[index])); }
      set { List[index] = value; }
    }
    /// <summary>
    /// Add a name to the collection
    /// </summary>
    /// <param name="name">name object to add</param>
    /// <returns>new count</returns>
    public int Add(IName name)
    {
      return List.Add(name);
    }
    /// <summary>
    /// Insert a name in the collection at a specific position
    /// </summary>
    /// <param name="index">position to insert the name at</param>
    /// <param name="name">name to insert</param>
    public void Insert(int index, IName name)
    {
      List.Insert(index, name);
    }
    /// <summary>
    /// Remove a name from the collection
    /// </summary>
    /// <param name="name">the name to remove</param>
    public void Remove(IName name)
    {
      List.Remove(name);
    }
    /// <summary>
    /// Check for a name in the collection
    /// </summary>
    /// <param name="name">name to look for</param>
    /// <returns>true if the collection contains an object that matches the given name</returns>
    public bool Contains(IName name)
    {
      return List.Contains(name);
    }
	}
}
